﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace DiscoveryLogic.UI.Layouts.Controls
{
    public partial class TradeHistoryNoteEditDialog : UserControl
    {       
        public TradeHistoryNoteEditDialog()
        {
            InitializeComponent();
        }

        public string DialogText
        {
            get { return EditNoteTextBox.Text; }
            set { EditNoteTextBox.Text = value; }
        }

        public void focusOn()
        {
            Dispatcher.BeginInvoke(new System.Threading.ThreadStart(delegate()
            {
                // Must be tabstop = true in order to be able to Focus() ;
                EditNoteTextBox.IsTabStop = true;
                bool result = EditNoteTextBox.Focus();
                System.Diagnostics.Debug.WriteLine("Setting focus " + ((result) ? "succeeded" : "failed"));

            }), null);
            // bool test = EditNoteTextBox.Focus();

        }

        private void EditNoteTextBox_GotFocus(object sender, RoutedEventArgs e)
        {
          
        }

        private void SaveButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (editNoteSave != null)
            {
                editNoteSave(this, e);
            }
        }

        private void DeleteButton_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (editNoteDelete != null)
            {
                editNoteDelete(this, e);
            }
        }

        public event EventHandler editNoteSave;
        public event EventHandler editNoteDelete;
    }
}
